package net.hualisheng.netty.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.AmqpException;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 定义发送队列消息、红包、用户红包、抢红包业务Service接口具体实现
 */
@Service
public class CommonMQServiceImpl implements CommonMQService {
    private static final Logger loggert= LoggerFactory.getLogger(CommonMQServiceImpl.class);

    @Autowired
    RabbitTemplate rabbitTemplate;
    @Override
    public void sendGradRedPack(String userId) {
        try {
            rabbitTemplate.convertAndSend("info",userId);
        }catch (AmqpException ex){
            loggert.error("推送用户抢红包的消息操作失败:" + ex.getMessage());
            ex.printStackTrace();
        }

    }
}
